package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000119685974";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCBeLVrKxWTQ635xS60V0/mNaCZNx1ghxRIc/PNezvuFmAQszoN7h5PiwDZyTgHsdJm3nAbXdyawGbrEiLr+PpvyWuqoJpml6ee5CcuBqmzxIPcM2Zq/zqQn7TytNnYmYVxYN2eiJ5WxpDc4zpCjx7VLBMT1M4lAsYDzvHzwskL2aihmrGai7MCoyvJrra4BrT9/OXvhNJaesfGS3AtpNsqFtUjAYVJXrsWLifRRtc8steulzBs9j7NdLkKR+gsOcy10Am0WVsR7f/1Z/wgF7hm58QDyQv6XSzGYj/I5d+GdwZRioKQyNaqAja1+6nUiYxHrK6DRiSFb54CqlU/xiAdAgMBAAECggEAVtVQR2oD9Fql6ih3JHiSm8FHzrqKN10hG165Gw0Vqp7TGyA5RXJ4XbzKe0ZbD74RcPCqm5AeDqQP4oStazn3LNYYIb3JEBmSUByQsmvBkVGxZhQLEqPO8YRLZaQpnv2H4/ylZlgWafiO27aCMnWupiYDPX+yKlxr1c4LtALlt83q0Z0hKWX0JBG6Z9+oXDk7jzdhGLzhvKpzwrXC09+73GmEQFjw1IwCTDIl/NyPtIMAp192Z31SRft7yLaJ6cDwIiyMFSMMpvGTu/zJdiuQ1wVk8CiKgCU6tQaMShK8FuhCiEnO+SSNKa1vc/kjKuN7Md56GU/CeIRtNzhzD4JruQKBgQDyqj3+T/PdZpW2G4e0aaCoBMrOEZk2F1MIIIqoOmBklFGiWSZRWsbtVtOndMJt+jUNAyn+LQoJepJSLZm8UrTi7+YCBx/zmp3BbGXHK/B/gkFhIhsHwA6cZ7y7LdCg6dpWTMmcMchIkPEi951fbi4WXRqKXLU52271V0FyNLHWowKBgQCIlhXfabkg7c2EoK+xDvCTjtzBEqpCYoMVFS+PtpY/yhlj400nV8k8NZte/nysWV1v2AE9KKmCl7ST6t3MbFIgThre7pDizQWnm4nVgvtNJYTxizow9EQKVBXuLz8YyoFaCZjqLLTfakDpPdW6ZoFCd+2GMpmPpwPsCP79BQ9aPwKBgDjWMwr7wwyaWHp83D4fd2ejJ7U4XgBTWjlPFertMWKdcrlp1BW+A1XXvl88c8W6ku5nTVChT/aEZP0mfRmk7YUx11emP4+ZKVYCg5ww6HWVFqcfi+E21LVBfu0AgBsQavlHpvkUl+qXOEOOZ6fQcK8AQ5Ugvbm9cbG5LDUJrpWtAoGANjOQ9HqI66dSsjnt3o52K6g6tCeLBxL+v6QLnrUvRJsXnkr6OA2fHtSLFpRYtzAzYwnN3A5BzkATectvPwsRQB6ejS8Qsd/4SX3woZj7zq5/5jaA3iJgydR6a222VUkvMaKzWuJo2Gva3HQcV38L9muPB30W8Smu5cDgJ1oVsJMCgYAfwCkbAUyUCWWL+OHicN1opYS4wQ5fVClnmlmoQAsQ+iagV3+Tr4+qPycezFddYE79NnnDK+8MuNg715bC1BkzV+NhJkEgmLLW8AJJ2gUhD4bVDxTVLhJW+SR3fz8tnF8GLSoC+InoyGH1m8FpiLLNLLWfXMC/q9pPU34Xcx5M6Q==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArch/BRh/5jyN5g5lcWG6lTb5WeBM1qDPTFzCIt5+eCJtuVqAGEcdWZbKDmotl/3Q+kIzzqWWGi9BxzNYQsOPzLhSoyN/Htzdj8mVLLL4F/kShT7bXnT2qbc+iDEMU5j5FVsUYkJdPhTriiHyhlbvLvBcmzqP3u70fxCBfs+78VQaLJ1CXbsOtPJp1yhL0zVCLhJbHtQTP8nYtNaJlf1BpQrYPjBjYyjVoXZ9qp5Gq1O2tH7ZyC/JKFJJABjVI0DDyjw4yq9fc70l18WD3zqs1/06nx6jVLCDadofRpHLvDK1PbLXycgjL2SPi2o3Je3yqDvEnPZUJXM38h3hYoVGWQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://n2xwhx.natappfree.cc/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://n2xwhx.natappfree.cc/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

